package org.jeecg.modules.veterans.service.impl;

import jdk.nashorn.internal.parser.Token;
import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.TokenUtils;
import org.jeecg.config.mybatis.MybatisInterceptor;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.util.SecurityUtil;
import org.jeecg.modules.veterans.entity.SysViewRecord;
import org.jeecg.modules.veterans.mapper.SysViewRecordMapper;
import org.jeecg.modules.veterans.service.ISysViewRecordService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Date;

/**
 * @Description: 浏览记录信息表
 * @Author: jeecg-boot
 * @Date:   2022-07-06
 * @Version: V1.0
 */
@Service
public class SysViewRecordServiceImpl extends ServiceImpl<SysViewRecordMapper, SysViewRecord> implements ISysViewRecordService {

    @Override
    public boolean saveByOne(SysViewRecord record){
        LoginUser loginUser = SecurityUtil.getLoginUser();
        record.setName(loginUser.getUsername());
        record.setUserId(loginUser.getId());
        record.setView("1");
        record.setViewtime(new Date());
        return save(record);
    }

}
